package com.ra.controller;


import com.ra.pojo.RespBean;
import com.ra.pojo.dto.PasswordDTO;
import com.ra.pojo.dto.UserInfoDTO;
import com.ra.service.IUserAuthService;
import com.ra.service.IUserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 今晚几点睡_Ada
 * @since 2023-03-09
 */
@RestController
@Api(tags = "用户账号模块")
public class UserAuthController {
    @Autowired
    private IUserAuthService userAuthService;
    @Autowired
    private IUserInfoService userInfoService;

    @PutMapping("/users/info")
    @ApiOperation("更新用户信息")
    public RespBean<?> updateUserInfo(@Valid @RequestBody UserInfoDTO userInfo) {
        return userInfoService.updateUserInfo(userInfo);
    }

    @ApiOperation(value = "修改管理员密码")
    @PutMapping("/admin/users/password")
    public RespBean<?> updateAdminPassword(@Valid @RequestBody PasswordDTO passwordDTO) {

        return userAuthService.updateAdminPassword(passwordDTO);
    }



}







